from util.sqlite_database import SQLite
import win32com
import win32gui
def set_foreground_window(name):
    handle = win32gui.FindWindow(None, name)
    print(handle)
    if handle == 0:
        return False
    else:
        shell = win32com.client.Dispatch("WScript.Shell")
        shell.SendKeys('%')
        win32gui.SetForegroundWindow(handle)
        return True
def get_all_hwnd(hwnd, title):
    if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd):
        window_name = win32gui.GetWindowText(hwnd)
        if title in window_name:
            set_foreground_window(window_name)


sqlite = SQLite('D:\\apply.db')